package biz.innovasoft.nodb.transaction;

import java.util.Date;

import org.prevayler.Transaction;

import biz.innovasoft.nodb.DeleteValidator;
import biz.innovasoft.nodb.impl.GenericRepository;

public class AddDeleteValidatorTransaction implements Transaction {

	private static final long serialVersionUID = 1L;
	
	private final String validatorName;
	private final Class<?> clazz;
	private final DeleteValidator validator;

	public AddDeleteValidatorTransaction(String validatorName, Class<?> clazz,
			DeleteValidator validator) {
		this.validatorName = validatorName;
		this.clazz = clazz;
		this.validator = validator;
	}

	@Override
	public void executeOn(Object prevalentSystem, Date time) {
		GenericRepository repository = (GenericRepository)prevalentSystem;
		repository.addDeleteValidator(validatorName, clazz, validator);
	}

}
